package com.usian;

import com.usian.pojo.*;
import com.usian.utils.CatResult;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "usian-item-service")
public interface ItemFeign {

    @RequestMapping("selectItemInfo")
    public TbItem selectItemInfo(@RequestParam Long itemId);


    @RequestMapping("selectTbItemAllByPage")
    public PageResult selectTbItemAllByPage(@RequestParam Integer page,
                                                       @RequestParam Integer rows);

    @RequestMapping("selectItemCategoryByParentId")
    public List<TbItemCat> selectItemCategoryByParentId(@RequestParam Long id);

    @RequestMapping("selectItemParamByItemCatId/{itemCatId}")
    public TbItemParam selectItemParamByItemCatId(@PathVariable Long itemCatId);

    /**
     * 添加商品
     * @param item
     * @param desc
     * @param itemParams
     * @return
     */
    @RequestMapping("insertTbItem")
    public Integer insertTbItem(@RequestBody TbItem item, @RequestParam String desc, @RequestParam String itemParams);

    /**
     * 商品回显
     *
     * @param itemId
     * @return
     */
    @RequestMapping("preUpdateItem")
    public Map<String,Object> preUpdateItem(@RequestParam  Long itemId);

    /**
     *
     * 修改商品
     *
     * @param item
     * @param desc
     * @param itemParams
     * @return
     */
    @RequestMapping("updateTbItem")
    public Integer updateTbItem(@RequestBody TbItem item, @RequestParam String desc, @RequestParam String itemParams);

    /**
     * 删除商品
     *
     * @param itemId
     * @return
     */
    @RequestMapping("deleteItemById")
    public Integer deleteItemById(@RequestParam Long itemId);


    /**
     * 查询商品规格列表
     *
     * @param page
     * @param rows
     * @return
     */
    @RequestMapping("selectItemParamAll")
    public PageResult selectItemParamAll(@RequestParam Integer page,
                                     @RequestParam Integer rows);

    /**
     * 添加商品参数模版
     *
     * @param itemCatId
     * @param paramData
     * @return
     */
    @RequestMapping("insertItemParam")
    public Integer insertItemParam(@RequestParam Integer itemCatId,@RequestParam String paramData);

    /**
     * 删除商品参数模版
     *
     * @param id
     * @return
     */
    @RequestMapping("deleteItemParamById")
    public Integer deleteItemParamById(@RequestParam Integer id);

    /**
     * 首页查询分类
     *
     * @return
     */
    @RequestMapping("selectItemCategoryAll")
    public CatResult selectItemCategoryAll();


    /**
     * 根据id查询商品描述
     *
     * @return
     */
    @RequestMapping("selectItemDescByItemId")
    public TbItemDesc selectItemDescByItemId(@RequestParam Long itemId);

    /**
     * 根据id 查询商品分类信息
     *
     * @param itemId
     * @return
     */
    @RequestMapping("selectTbItemParamItemByItemId")
    public TbItemParamItem selectTbItemParamItemByItemId(@RequestParam Long itemId);
}
